home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / gpt32src.zip / TEK.TRM < prev    next >
Text File  |  1992-03-25  |  7KB  |  364 lines

  1. /*
  2.  * $Id: tek.trm,v 3.26 92/03/24 22:35:45 woo Exp Locker: woo $
  3.  */
  4.  
  5. /* GNUPLOT - tek.trm */
  6. /*
  7.  * Copyright (C) 1990, 1991, 1992   
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted, 
  11.  * provided that the above copyright notice appear in all copies and 
  12.  * that both that copyright notice and this permission notice appear 
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the modified code.  Modifications are to be distributed 
  17.  * as patches to released version.
  18.  *  
  19.  * This software  is provided "as is" without express or implied warranty.
  20.  * 
  21.  * This file is included by ../term.c.
  22.  *
  23.  * This terminal driver supports:
  24.  *  tek40xx, bitgraph, kermit_color_tek40xx, kermit_mono_tek40xx, selanar
  25.  *  ln03plus
  26.  *
  27.  * AUTHORS
  28.  *   Colin Kelley, Thomas Williams, Russell Lang
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@ames.arc.nasa.gov).
  31.  * 
  32.  */
  33.  
  34. #ifdef TEK
  35.  
  36. #define TEK40XMAX 1024
  37. #define TEK40YMAX 780
  38.  
  39. #define TEK40XLAST (TEK40XMAX - 1)
  40. #define TEK40YLAST (TEK40YMAX - 1)
  41.  
  42. #define TEK40VCHAR        25
  43. #define TEK40HCHAR        14
  44. #define TEK40VTIC        11
  45. #define TEK40HTIC        11    
  46.  
  47. #define HX 0x20        /* bit pattern to OR over 5-bit data */
  48. #define HY 0x20
  49. #define LX 0x40
  50. #define LY 0x60
  51.  
  52. #define LOWER5 31
  53. #define UPPER5 (31<<5)
  54.  
  55.  
  56. TEK40init()
  57. {
  58. }
  59.  
  60.  
  61. TEK40graphics()
  62. {
  63. #ifdef vms
  64.     term_pasthru();
  65. #endif /* vms */
  66.     fprintf(outfile,"\033\014");
  67. /*                   1
  68.     1. clear screen
  69. */
  70.     (void) fflush(outfile);
  71.     sleep(1);  
  72.     /* sleep 1 second to allow screen time to clear on real 
  73.        tektronix terminals */
  74. }
  75.  
  76. TEK40text()
  77. {
  78.     TEK40move(0,12);
  79.     fprintf(outfile,"\037");
  80. /*                   1
  81.     1. into alphanumerics
  82. */
  83. #ifdef vms
  84.     term_nopasthru();
  85. #endif /* vms */
  86. }
  87.  
  88.  
  89. TEK40linetype(linetype)
  90. int linetype;
  91. {
  92. }
  93.  
  94. TEK40move(x,y)
  95. unsigned int x,y;
  96. {
  97.     (void) putc('\035', outfile);    /* into graphics */
  98.     TEK40vector(x,y);
  99. }
  100.  
  101.  
  102. TEK40vector(x,y)
  103. unsigned int x,y;
  104. {
  105.     (void) putc((HY | (y & UPPER5)>>5), outfile);
  106.     (void) putc((LY | (y & LOWER5)), outfile);
  107.     (void) putc((HX | (x & UPPER5)>>5), outfile);
  108.     (void) putc((LX | (x & LOWER5)), outfile);
  109. }
  110.  
  111.  
  112. TEK40put_text(x,y,str)
  113. unsigned int x,y;
  114. char str[];
  115. {
  116.     TEK40move(x,y-11);
  117.     fprintf(outfile,"\037%s\n",str);
  118. }
  119.  
  120.  
  121. TEK40reset()
  122. {
  123. }
  124.  
  125. #endif /* TEK */
  126.  
  127.  
  128.  
  129. /* thanks to dukecdu!evs (Ed Simpson) for the BBN BitGraph driver */
  130.  
  131. #ifdef BITGRAPH
  132.  
  133. #define BG_XMAX                 768 /* width of plot area */
  134. #define BG_YMAX                 768 /* height of plot area */
  135. #define BG_SCREEN_HEIGHT    1024 /* full screen height */
  136.  
  137. #define BG_XLAST     (BG_XMAX - 1)
  138. #define BG_YLAST     (BG_YMAX - 1)
  139.  
  140. #define BG_VCHAR    16
  141. #define BG_HCHAR     9
  142. #define BG_VTIC         8
  143. #define BG_HTIC         8    
  144.  
  145.  
  146. #define BG_init TEK40init
  147.  
  148. #define BG_graphics TEK40graphics
  149.  
  150.  
  151. #define BG_linetype TEK40linetype
  152.  
  153. #define BG_move TEK40move
  154.  
  155. #define BG_vector TEK40vector
  156.  
  157.  
  158. BG_text()
  159. {
  160.     BG_move(0, BG_SCREEN_HEIGHT - 2 * BG_VCHAR);
  161.     fprintf(outfile,"\037");
  162. /*                   1
  163.     1. into alphanumerics
  164. */
  165. }
  166.  
  167.  
  168. BG_put_text(x,y,str)
  169. unsigned int x,y;
  170. char str[];
  171. {
  172.     BG_move(x,y-11);
  173.     fprintf(outfile,"\037%s\n",str);
  174. }
  175.  
  176.  
  177. #define BG_reset TEK40reset
  178.  
  179. #endif /* BITGRAPH */
  180.  
  181.  
  182. /* Color and Monochrome specials for the MS-Kermit Tektronix Emulator
  183.    by Russell Lang,  eln272v@monu1.cc.monash.oz  */
  184.  
  185. #ifdef KERMIT
  186.  
  187. #define KTEK40HCHAR        13
  188.  
  189. KTEK40graphics()
  190. {
  191. #ifdef vms
  192.         term_mode_tek();
  193.     term_pasthru();
  194. #endif /* vms */
  195.     fprintf(outfile,"\033\014");
  196. /*                   1
  197.     1. clear screen
  198. */
  199.     /* kermit tektronix emulation doesn't need to wait */
  200. }
  201.  
  202. KTEK40Ctext()
  203. {
  204.     TEK40text();
  205.     KTEK40Clinetype(0);  /* change to green */
  206. #ifdef vms
  207.     term_nopasthru();
  208. #endif /* vms */
  209. }
  210.  
  211. /* special color linetypes for MS-DOS Kermit v2.31 tektronix emulator */
  212. /*    0 = normal, 1 = bright 
  213.     foreground color (30-37) = 30 + colors
  214.         where colors are   1=red, 2=green, 4=blue */
  215. static char *kermit_color[15]= {"\033[0;37m","\033[1;30m",
  216.         "\033[0;32m","\033[0;36m","\033[0;31m","\033[0;35m",
  217.         "\033[1;34m","\033[1;33m","\033[1;31m","\033[1;37m",
  218.         "\033[1;35m","\033[1;32m","\033[1;36m","\033[0;34m",
  219.         "\033[0;33m"};
  220.  
  221. KTEK40Clinetype(linetype)
  222. int linetype;
  223. {
  224.     if (linetype >= 13)
  225.         linetype %= 13;
  226.     fprintf(outfile,"%s",kermit_color[linetype+2]);
  227. }
  228.  
  229.  
  230. /* linetypes for MS-DOS Kermit v2.30 tektronix emulator */
  231. /* `=solid, a=fine dots, b=short dashes, c=dash dot, 
  232.    d=long dash dot, e=dash dot dot */
  233. static char *kerm_linetype = "`a`abcde" ;
  234.  
  235. KTEK40Mlinetype(linetype)
  236. int linetype;
  237. {
  238.     if (linetype >= 6)
  239.         linetype %= 6;
  240.     fprintf(outfile,"\033%c",kerm_linetype[linetype+2]);
  241. }
  242.  
  243. KTEK40reset()
  244. {
  245.     fprintf(outfile,"\030\n");  /* turn off Tek emulation */
  246. #ifdef vms
  247.     term_mode_native();
  248. #endif /* vms */
  249. }
  250.  
  251. #endif /* KERMIT */
  252.  
  253.  
  254. /* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the
  255.    Selanar driver */
  256.  
  257. #ifdef SELANAR
  258.  
  259. SEL_init()
  260. {
  261.     fprintf(outfile,"\033\062");
  262. /*                    1
  263.     1. set to ansi mode
  264. */
  265. }
  266.  
  267.  
  268. SEL_graphics()
  269. {
  270.     fprintf(outfile,"\033[H\033[J\033\061\033\014");
  271. /*                   1           2       3
  272.     1. clear ANSI screen
  273.     2. set to TEK mode
  274.     3. clear screen
  275. */
  276. }
  277.  
  278.  
  279. SEL_text()
  280. {
  281.     TEK40move(0,12);
  282.     fprintf(outfile,"\033\062");
  283. /*                   1
  284.     1. into ANSI mode
  285. */
  286. }
  287.  
  288. SEL_reset()
  289. {
  290.     fprintf(outfile,"\033\061\033\012\033\062\033[H\033[J");
  291. /*                   1        2       3      4
  292. 1       set tek mode
  293. 2       clear screen
  294. 3       set ansi mode
  295. 4       clear screen
  296. */
  297. }
  298. #endif /* SELANAR */
  299.  
  300. #ifdef VTTEK
  301.  
  302. VTTEK40init()
  303. {
  304.         fprintf(outfile,"\033[?38h");
  305.         fflush(outfile);
  306.         sleep(1);
  307.         /* sleep 1 second to allow screen time to clear on some terminals */
  308. #ifdef vms
  309.         term_mode_tek();
  310. #endif /* vms */
  311. }
  312.  
  313. VTTEK40reset()
  314. {
  315.         fprintf(outfile,"\033[?38l");
  316.         fflush(outfile);
  317.         sleep(1);
  318.         /* sleep 1 second to allow screen time to clear on some terminals */
  319. #ifdef vms
  320.         term_mode_native();
  321. #endif /* vms */
  322. }
  323.  
  324. /* linetypes for VT-type terminals in tektronix emulator mode */
  325. /* `=solid, a=fine dots, b=short dashes, c=dash dot,
  326.    d=long dash dot, h=bold solid, i=bold fine dots, j=bold short dashes,
  327.    k=bold dash dot, l=bold long dash dot */
  328. static char *vt_linetype = "`a`abcdhijkl" ;
  329. static int last_vt_linetype = 0;
  330. VTTEK40linetype(linetype)
  331. int linetype;
  332. {
  333.         if (linetype >= 10)
  334.                 linetype %= 10;
  335.         fprintf(outfile,"\033%c",vt_linetype[linetype+2]);
  336.         last_vt_linetype = linetype;
  337. }
  338.  
  339. VTTEK40put_text(x,y,str)
  340. unsigned int x,y;
  341. char str[];
  342. {
  343.         int linetype;
  344.         linetype = last_vt_linetype;
  345.         VTTEK40linetype(0);
  346.         TEK40put_text(x,y,str);
  347.         VTTEK40linetype(linetype);
  348. }
  349.  
  350. #endif /* VTTEK */
  351.  
  352. #ifdef LN03P
  353.  
  354. LN03Pinit()
  355. {
  356.     fprintf(outfile,"\033[?38h");
  357. }
  358.  
  359. LN03Preset()
  360. {
  361.     fprintf(outfile,"\033[?38l");
  362. }
  363. #endif /* LN03P */
  364.